package com.base.api.controller.selfOrderComment;

import com.base.api.dto.selfOrderComment.AddSelfOrderCommentDTO;
import com.base.api.dto.selfOrderComment.SelfOrderCommentListDTO;
import com.base.api.service.selfOrderComment.SelfOrderCommentApiService;
import com.base.log.LogOutAnnotation;
import com.base.result.ResponseResult;
import com.base.self.entity.SelfOrderComment;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/api/selfOrderComment")
@Api(tags = "商品晒单")
public class SelfOrderCommentApiController {

    private final SelfOrderCommentApiService selfOrderCommentApiService;

    public SelfOrderCommentApiController(SelfOrderCommentApiService selfOrderCommentApiService) {
        this.selfOrderCommentApiService = selfOrderCommentApiService;
    }

    @ApiOperation(value="添加商品晒单")
    @PostMapping(value = "/addSelfOrderComment", produces = "application/json;charset=UTF-8")
    @LogOutAnnotation(url = "/addSelfOrderComment")
    public ResponseResult addSelfOrderComment(@Validated AddSelfOrderCommentDTO addSelfOrderCommentDTO) {
        return selfOrderCommentApiService.addSelfOrderComment(addSelfOrderCommentDTO);
    }

    @ApiOperation(value="查看晒单列表")
    @PostMapping(value = "/selfOrderCommentList", produces = "application/json;charset=UTF-8")
    @LogOutAnnotation(url = "/selfOrderCommentList")
    @ApiResponses({
            @ApiResponse(code = 200, message = "OK", response = SelfOrderComment.class),
    })
    public ResponseResult selfOrderCommentList(@Validated SelfOrderCommentListDTO selfOrderCommentListDTO) {
        return selfOrderCommentApiService.selfOrderCommentList(selfOrderCommentListDTO);
    }
}
